package com.cardvalue.sys.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.cardvalue.sys.R;
import com.cardvalue.sys.adapter.IndustryRecylerAdapter;
import com.cardvalue.sys.adapter.LinkRecylerAdapter;
import com.cardvalue.sys.base.BaseActivity;
import com.cardvalue.sys.entity.Industrylist;
import com.cardvalue.sys.mode.UserService;
import com.cardvalue.sys.tool.DividerItemDecoration;

import java.util.ArrayList;

import butterknife.Bind;

public class LinkAgeThree extends BaseActivity {
    @Bind(R.id.iv_left) ImageView iv_left;//返回键
    @Bind(R.id.recyclerView) RecyclerView mRecyclerView;
    private IndustryRecylerAdapter mIndustryRecylerAdapter;//行业
    private UserService updateInfo;
    private String tagName;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_linkage_three);
        updateInfo=new UserService(this);
        //创建一个线性布局管理器,然后设置布局的方向
        LinearLayoutManager  layoutManager= new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayout.VERTICAL);
        //设置布局管理器
        mRecyclerView.setLayoutManager(layoutManager);
        tagName = getIntent().getStringExtra("tagName");



        mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkAgeThree.this);
        mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkAgeThree.this, LinearLayoutManager.VERTICAL));
        mRecyclerView.setAdapter(mIndustryRecylerAdapter);

        if(tagName.equals("Industry")){
            updateInfo.getIndustrylist(null, null, new UserService.IndustryCallback() {
                @Override
                public void success(ArrayList<Industrylist> industrylists) {
                    mIndustryRecylerAdapter.update(industrylists);
                }

                @Override
                public void fail(String msg) {

                }

                @Override
                public void cancelDialog() {

                }
            });
        }





    }
}
